<#assign tit>上传附件</#assign>
<@page.html title=tit>
<script type="text/javascript" src="${_appPath!}/js/upload.js"></script>
<script type="text/javascript">
  function doUpload(fm) {
    if(_isupl) return;
    if(!chkfile(fm.file.value)) return false;
    _isupl = true;
    return true;
  }
  function chkfile(ff) {
    if(ff!="") {
      var ext = ff.substr(ff.length-4).toLowerCase();
      if(ext==".gif" || ext==".jpg" || ext==".png" || ext==".flv") {
        return true;
      } else
        window.alert("只能上传gif,jpg,png和flv格式");
    } else {
      window.alert("请选择文件");
    }
    return false;
  }
  function uploadSucc(f) {
    window.alert("上传成功");
    var tb = getEl("tb_img");
    if(tb) {
      var td = tb.insertRow(0).insertCell(-1);
      td.colSpan = 2;
      td.innerHTML = '<img src="${_picPath!}'+ f.furl+'" style="max-width:400px;"/>';
    }
  }
</script>
<div>

  <form id="fm_upload" method="post" action="_upload" enctype="multipart/form-data" target="ifm_upload" onsubmit="return doUpload(this);">
    <input type="hidden" name="id" value="${workflow.workflowId}">
    <div class="kbox">
      <table class="input" id="tb_img">
        <#if flist??><#list flist as c>
        <tr>
          <td colspan="2"><img src="${_picPath!}${c.fileUrl!}" style="max-width:400px;"/></td>
        </tr>
        </#list></#if>
        <tr>
          <th>选择图片</th>
          <td><input type="file" name="file"></td>
        </tr>
      </table>
      <div class="button" style="margin:10px;"><input type="submit" value="上传"></div>
    </div>
  </form>
  <iframe name="ifm_upload" onload="uploadOk(this);" style="width:0px; height:0px; display:none;"></iframe>
</div>
</@page.html>